class Checkbox {
    props = {
        defaultChecked: Boolean,
        checked: Boolean,
        disabled: Boolean,
        onChange: Function,
    };

    state = {
        checked: this.props.checked || this.props.defaultChecked,
        disabled: this.props.disabled
    }

    watch = {
        checked: function (newValue) {
            if (newValue !== undefined) {
                this.state.checked = newValue;
            }
        },
        disabled: function (newValue) {
            if (newValue !== undefined) {
                this.state.disabled = newValue
            }
        }
    }

    handleClick($event) {
        this.state.checked = !this.state.checked;
        this.props.onChange({event: $event})
    }
}
